
--[[---------------------------------------------------------
   Initializes the effect. The data is a table of data 
   which was passed from the server.
-----------------------------------------------------------]]

local Laser = Material( "trails/physbeam" )


function EFFECT:Init( data )
	self.Target = data:GetEntity()
	self.StartTime	= CurTime()
	self.Length		= 0.3
		
end


--[[---------------------------------------------------------
   THINK
-----------------------------------------------------------]]
function EFFECT:Think( )
	
	//if ( effects_freeze:GetBool() == false ) then return false end
	return self.StartTime + self.Length > CurTime()
	
end

--[[---------------------------------------------------------
   Draw the effect
-----------------------------------------------------------]]
function EFFECT:Render()

	if ( !IsValid( self.Target ) ) then return end
	
	local delta = ((CurTime() - self.StartTime) / self.Length) ^ 0.5
	local idelta = 1-delta
	
	effects.halo.Add( {self.Target}, Color( 0, 255, 255, 255 * idelta ), 2 / idelta, 1, 1, true, false )
	//local Vector1 = self:LocalToWorld( Vector( 0, 0, 0 ) )
	//local Vector2 = self:LocalToWorld( Vector( 0, 0, 100*(1-(CurTime()-self.StartTime)/self.Length )) )
 
	//render.SetMaterial( Laser )
	//render.DrawBeam( Vector1, Vector2, 400, 1, 1, Color( 0, 255, 255, 255 ) ) 
end
